export default {
	data() {
		return {
			myProject: 'OnlineLearning 的项目'
		}
	},
	methods: {
		hello() {
			console.log("hello for mixin")
		},
		sleep(time) {
			return new Promise((resolve) => setTimeout(resolve, time));
		},
		toast(msg, type) {
			let strType = "success"
			switch (type) {
				case 0:
					strType = "primary"
					break
				case 1:
					strType = "success"
					break
				case 2:
					strType = "error"
					break
				case 3:
					strType = "warning"
					break
				case 4:
					strType = "info"
					break
				default:
					strType = "success"
			}
			this.$refs.uToast.show({
				title: msg,
				type: strType,
				position: "bottom",
			})
			
			// uni.showToast({
			// 	title: msg,
			// 	duration: 2000,
			// 	icon: "none",
			// 	position: "bottom"
			// });
		},
	}
}

// const myMethods = {
// 	toast(msg, type) {
// 		let strType = "success"
// 		switch (type) {
// 			case 0:
// 				strType = "primary"
// 				break
// 			case 1:
// 				strType = "success"
// 				break
// 			case 2:
// 				strType = "error"
// 				break
// 			case 3:
// 				strType = "warning"
// 				break
// 			case 4:
// 				strType = "info"
// 				break
// 			default:
// 				strType = "success"
// 		}
// 		this.$refs.uToast.show({
// 			title: msg,
// 			type: strType,
// 			position: "top",
// 		})
// 	},
// }
